/*
 * TimingEngine.h
 *
 *  Created on: 2010-11-22
 *      Author: leo
 */

#ifndef TIMINGENGINE_H_
#define TIMINGENGINE_H_

#include <boost/thread/thread.hpp>

#include "LocalTask.h"
#include <list>

using boost::thread;

namespace GTD {

typedef list < LocalTask >	Tasks;

class TimingEngine {
public:
	TimingEngine();
	virtual ~TimingEngine();
	static void	timingRoutine();
	static void	adminRoutine();
	static void	startEngine();
	static void	stopEngine();
	static void registTask(LocalTask task);
	static void dumpTasks();
	static size_t getTasksCnt();
private:
	static thread* _ptimerThread;
	static thread* _padminThread;
	static bool		_routineStop;
	static bool		_adminStop;
	static Tasks 	_tasks;
	static boost::mutex	_tasksMutex;
};

}

#endif /* TIMINGENGINE_H_ */
